package com.uchedao.vehicledetection.view.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
 * 
* @Description: 可设置是否滑动的viewpage
* @author wushan
* @date 2015年8月20日 下午1:53:28 
*
 */
public class CJDViewPage extends ViewPager{

	 private boolean noScroll = false;
	 
	    public CJDViewPage(Context context, AttributeSet attrs) {
	        super(context, attrs);
	    }
	 
	    public CJDViewPage(Context context) {
	        super(context);
	    }
	 
	    public void setNoScroll(boolean noScroll) {
	        this.noScroll = noScroll;
	    }
	 
	    @Override
	    public void scrollTo(int x, int y) {
	        super.scrollTo(x, y);
	    }
	 
	    @Override
	    public boolean onTouchEvent(MotionEvent arg0) {
	        /* return false;//super.onTouchEvent(arg0); */
	        if (noScroll)
	            return false;
	        else
	            return super.onTouchEvent(arg0);
	    }
	 
	    @Override
	    public boolean onInterceptTouchEvent(MotionEvent arg0) {
	        if (noScroll)
	            return false;
	        else
	            return super.onInterceptTouchEvent(arg0);
	    }
	 
	    @Override
	    public void setCurrentItem(int item, boolean smoothScroll) {
	        super.setCurrentItem(item, smoothScroll);
	    }
	 
	    @Override
	    public void setCurrentItem(int item) {
	        super.setCurrentItem(item);
	    }
	 
}
